﻿Imports LukeSw.Windows.Forms

Public Class frmMSC
    Private CheckConn As New CheckInternetConnection()
    Dim RunError As Boolean
    Dim mscc As Boolean

    Private Sub btnRefresh_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnRefresh.Click
        wbMSC.Refresh()
    End Sub

    Private Sub wbMSC_Navigated(ByVal sender As System.Object, ByVal e As System.Windows.Forms.WebBrowserNavigatedEventArgs) Handles wbMSC.Navigated
        If RunError = False Then
            If wbMSC.DocumentTitle = "MeaMod Software Certification" Then
                mscc = True
            Else
                mscc = False
            End If
            If mscc = Not True Then
                wbMSC.DocumentText = "A error occurred verifying"
                btnRefresh.Enabled = False
            End If
            RunError = True
        End If

        If wbMSC.DocumentText = "A error occurred verifying" Then
            lblStatus.Text = "A error occurred verifying"
            tbAddress.Text = "A error occurred verifying"
        Else
            lblStatus.Text = wbMSC.DocumentTitle
            tbAddress.Text = wbMSC.Url.OriginalString
        End If
    End Sub

    Private Sub tbAddress_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles tbAddress.Click
        System.Diagnostics.Process.Start("http://meamod.com/certification/340823409823408.html")
    End Sub

    Private Sub frmMSC_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        If CStr(CheckConn.IsConnected()) = False Then
            Dim vd As New VDialog()
            With vd
                .WindowTitle = "No Internet Connection"
                .MainIcon = VDialogIcon.SecurityError
                .Buttons = New VDialogButton() {New VDialogButton(VDialogResult.OK)}
                .DefaultButton = VDialogDefaultButton.Button1
                .MainInstruction = "No Internet Conntection Detected"
                .Content = "Unable to connect verification server." & vbCrLf & "No Internet Conntection Detected"
                .Sound = VDialogSound.Error
                .Show()
            End With
            Me.Close()
        End If
    End Sub
End Class